package com.site.wisdom_construction.controller.statisticsModule;

import com.site.wisdom_construction.responseEntity.OneDataResult;
import com.site.wisdom_construction.service.statisticsModule.StatisticsAntiepidemicInformationService;
import com.site.wisdom_construction.statisticsResult.HealthCodeCount;
import com.site.wisdom_construction.statisticsResult.NucleicAcidCount;
import com.site.wisdom_construction.statisticsResult.TourCodeCount;
import com.site.wisdom_construction.statisticsResult.VaccinationCount;
import com.site.wisdom_construction.util.verification.NoToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author daiyifei
 * @Date 2022/3/9
 * @Description
 */
@Api(tags = "疫情防控统计数据接口")
@RestController
@RequestMapping("StatisticsAntiepidemicInformation")
@CrossOrigin
public class StatisticsAntiepidemicInformationController {
    @Autowired
    private StatisticsAntiepidemicInformationService statisticsAntiepidemicInformationService;

    @ApiOperation(value = "统计健康码数据", notes = "测试数据:")
    @PostMapping("/countHealthCode")
    @NoToken
    public OneDataResult countHealthCode(@RequestBody Map map) {
        OneDataResult oneDataResult = new OneDataResult();
        HealthCodeCount healthCodeCount = new HealthCodeCount();
        healthCodeCount.setCountHealthCodeL(statisticsAntiepidemicInformationService.countHealthCodeL(map));
        healthCodeCount.setCountHealthCodeH(statisticsAntiepidemicInformationService.countHealthCodeH(map));
        healthCodeCount.setCountHealthCodeHH(statisticsAntiepidemicInformationService.countHealthCodeHH(map));
        oneDataResult.setData(healthCodeCount);
        return oneDataResult;
    }

    @ApiOperation(value = "统计行程码数据", notes = "测试数据:")
    @PostMapping("/countTourCode")
    @NoToken
    public OneDataResult countTourCode(@RequestBody Map map) {
        OneDataResult oneDataResult = new OneDataResult();
        TourCodeCount tourCodeCount = new TourCodeCount();
        tourCodeCount.setCountTourCodeZc(statisticsAntiepidemicInformationService.countTourCodeZc(map));
        tourCodeCount.setCountTourCodeYc(statisticsAntiepidemicInformationService.countTourCodeYc(map));
        oneDataResult.setData(tourCodeCount);
        return oneDataResult;
    }

    @ApiOperation(value = "统计核酸报告数据", notes = "测试数据:")
    @PostMapping("/countNucleicAcid")
    @NoToken
    public OneDataResult countNucleicAcid(@RequestBody Map map) {
        OneDataResult oneDataResult = new OneDataResult();
        NucleicAcidCount nucleicAcidCount = new NucleicAcidCount();
        nucleicAcidCount.setCountNucleicAcidZ(statisticsAntiepidemicInformationService.countNucleicAcidZ(map));
        nucleicAcidCount.setCountNucleicAcidY(statisticsAntiepidemicInformationService.countNucleicAcidY(map));
        oneDataResult.setData(nucleicAcidCount);
        return oneDataResult;
    }

    @ApiOperation(value = "统计疫苗接种数据", notes = "测试数据:")
    @PostMapping("/countVaccination")
    @NoToken
    public OneDataResult countVaccination(@RequestBody Map map) {
        OneDataResult oneDataResult = new OneDataResult();
        VaccinationCount vaccinationCount = new VaccinationCount();
        vaccinationCount.setCountVaccinationOne(statisticsAntiepidemicInformationService.countVaccinationOne(map));
        vaccinationCount.setCountVaccinationTwo(statisticsAntiepidemicInformationService.countVaccinationTwo(map));
        vaccinationCount.setCountVaccinationThree(statisticsAntiepidemicInformationService.countVaccinationThree(map));
        oneDataResult.setData(vaccinationCount);
        return oneDataResult;
    }
}
